<style lang="less" scoped>
  .f-mt10 {
    margin-top: 10px;
  }

  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }

  .f-mb10 {
    margin-bottom: 10px;
  }

  .avatar-uploader .el-upload:hover {
    border-color: #20a0ff;
  }

  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }

  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }

  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }

  .f-w70 {
    width: 70%;
  }

  .f-w125 {
    width: 125%;
  }

  .f-w100 {
    width: 100%;
  }

  .my {
    margin-left: -60px;
  }

  .f-w120 {
    width: 120%;
  }

  .width70 {
    width: 70%;
  }

  .width50 {
    width: 50%;
  }

  .el-dialog {
    flex: 1;
    .isreceipt {
      display: none;
    }
    .receipt {
      display: inline-block;
    }
  }

  .backcolor {
    background-color: aqua
  }

  .f-w80 {
    position: absolute;
    margin-top: -6px;
    width: 80px;
  }
</style>
<template>
  <section>
    <el-tabs type="border-card" v-model="openBillAll" @tab-click="selectOpenBill">
      <el-tab-pane label="未开票" name="notOpenBilling">
        <!--工具条-->
        <search-bar more-display>
          <el-row>
            <el-col :span="8">
              <el-form-item label="客户名称">
                <el-input class="f-w70" v-model="notSearchCondition.LIKE_realName"
                          placeholder="请输入客户名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="发票类型">
                <el-select  v-model="notSearchCondition.EQ_taxsheetType"
                           placeholder="请选择">
                  <el-option
                    v-for="item in $store.getters.TAXSHEET_TYPE"
                    :key="item.dictVal"
                    :label="item.cnDictValname"
                    :value="item.dictVal">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="收件人">
                <el-input class="f-w70" v-model="notSearchCondition.LIKE_consigneeName"
                          placeholder="请输入收件人名称"></el-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="8">
              <el-form-item label="支付状态">
                <el-select  v-model="notSearchCondition.EQ_taxationPayStatus"
                           placeholder="请选择">
                  <el-option
                    v-for="item in $store.getters.ORDER_PAY_STATUS"
                    :key="item.dictVal"
                    :label="item.cnDictValname"
                    :value="item.dictVal">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="申请开票时间">
                <el-date-picker
                  v-model="notSearchCreateDate"
                  type="daterange"
                  placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="发票抬头">
                <el-input class="f-w70" v-model="notSearchCondition.LIKE_taxsheetTitle"
                          placeholder="请输入发票抬头名称"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </search-bar>
        <!-- 操作 -->
        <el-col :span="24" style="margin-bottom: 10px">
          <el-button type="primary" :disabled="this.sels.length===0">导出</el-button>
          <el-button type="primary" @click="notSearchReset" style="float: right">重置</el-button>
          <el-button type="primary" @click="notOpenBillSearch" style="float: right">查询</el-button>
        </el-col>
        <!--列表-->
        <el-table :data="tableData" highlight-current-row border @sort-change="sortChange" max-height="590"
                  @selection-change="selsChange" v-loading="listLoading" style="width: 100%;">
          <el-table-column type="selection" label="序号" width="100">
          </el-table-column>
          <el-table-column prop="realName" label="客户名称" width="150" >
          </el-table-column>
          <el-table-column prop="createDate" label="申请开票时间" width="180" >
          </el-table-column>
          <el-table-column prop="appTaxsheetAmount" label="开票金额(元)" width="140" >
            <template slot-scope="scope">
              <label v-if=" scope.row.appTaxsheetAmount != null">
                {{Math.floor(scope.row.appTaxsheetAmount * 100) / 100}}
              </label>
            </template>
          </el-table-column>
          <el-table-column prop="taxReceivable" label="应收税费(元)" width="140" >
            <template slot-scope="scope">
              <label v-if=" scope.row.taxReceivable != null">
                {{Math.floor(scope.row.taxReceivable * 100) / 100}}
              </label>
            </template>
          </el-table-column>
          <el-table-column prop="taxationPayStatusName" width="150" label="税费支付状态" >
          </el-table-column>
          <el-table-column prop="" label="发票信息">
            <template slot-scope="scope">
              <li style="list-style-type:none;" class="f-font-20 f-mb5">
                {{scope.row.taxsheetTypeName}}
              </li>
              <li style="list-style-type:none;" class="f-font-20 f-mb5">
                {{scope.row.taxsheetTitle}}
              </li>
            </template>
          </el-table-column>
          <el-table-column prop="" width="200" label="邮寄信息">
            <template slot-scope="scope">
              <li style="list-style-type:none;" class="f-font-20 f-mb5">
                {{scope.row.consigneeName}}   {{scope.row.phone}}
              </li>
              <li style="list-style-type:none;" class="f-font-20 f-mb5">
                {{scope.row.collectAddress}}
              </li>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="180">
            <template slot-scope="scope">
              <el-button  type="primary" @click="getEditBYId(scope.$index, scope.row)">详情 </el-button>
              <el-button type="primary"  @click="affirmOpenBill(scope.$index, scope.row)">确认开票</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!--工具条-->
        <el-col :span="24" class="toolbar">
          <el-pagination
            :current-page="currentPage"
            :page-size="pageSize"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            layout="total,sizes,prev, pager, next, jumper"
            :total="total" style="float: right">
          </el-pagination>
        </el-col>
        <!--确认开票弹窗 -->
        <el-dialog :title="affirmOpenBillTitle" size="tiny" :visible.sync="affirmOpenBillVisible"
                   :close-on-click-modal="false">
          <el-form :model="taxsheet" :rules="rules" label-width="110px" ref="taxsheet">
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="发票号码" class="width70" prop="taxsheetNo">
                  <el-input v-model="taxsheet.taxsheetNo" placeholder="请输入发票号码"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="开票时间" class="width70" prop="billingDate">
                  <el-date-picker
                    style="width: 100%"
                    v-model="taxsheet.billingDate"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="备注" prop="remark"  class="width70">
                  <el-input type="textarea" v-model="taxsheet.remark" placeholder="请输入备注"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="上传图片">
                  <el-upload
                    class="avatar-uploader"
                    action="/api/v2.0/admin/taxsheets_up_load"
                    :show-file-list="false"
                    :on-error="handleAvatarError"
                    :on-remove="handleRemove"
                    :on-success="handlePreview"
                    :before-upload="beforeAvatarUpload">
                    <img width="75%" v-if="oldHeadUrl && taxsheet.taxsheetPhotoUrl"
                         :src="decodeURI(taxsheet.httpHead+taxsheet.taxsheetPhotoUrl)"
                         class="avatar">
                    <img v-else-if="!oldHeadUrl && tempCurrentHeadUrl" :src="tempCurrentHeadUrl" class="avatar">
                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                  </el-upload>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button @click.native="affirmOpenBillVisible = false">取消</el-button>
            <el-button type="primary" @click.native="saveOpenBillDetail" :loading="submitLoading1">提交</el-button>
          </div>
        </el-dialog>
        <!--未开票--详情-->
        <el-dialog :title="notOpenBillTitle"  :visible.sync="notOpenBillVisible" :close-on-click-modal="false">
          <el-form :model="taxsheet" :rules="rules" label-width="110px" ref="taxsheet">
            <!--个人普通发票-->
            <div v-if="taxsheet.taxsheetType === 102013001">
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票类型" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTypeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票抬头" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTitle"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件人" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.consigneeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="手机号" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.phone"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件地址" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.collectAddress"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!--我的发票详情列表-->
              <el-table :data="taxsheet.taxsheetDetails" highlight-current-row border
                        max-height="500"
                        :summary-method="getSummaries"
                        show-summary v-loading="listLoading3" style="width: 100%;">
                <el-table-column type="index" label="序号" width="100">
                </el-table-column>
                <el-table-column prop="documentTypeName" label="单据类型">
                </el-table-column>
                <el-table-column prop="documentNumber" label="单据编号" width="200">
                </el-table-column>
                <el-table-column prop="documentAmount" label="单据金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.documentAmount != null">
                      {{Math.floor(scope.row.documentAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="currentInvoicedAmount" label="本次开票金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.currentInvoicedAmount != null">
                      {{Math.floor(scope.row.currentInvoicedAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="taxesAndFeesReceivable" label="本次应收税费(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.taxesAndFeesReceivable != null">
                      {{Math.floor(scope.row.taxesAndFeesReceivable * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <!--单位普通发票-->
            <div v-if="taxsheet.taxsheetType === 102013002">
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票类型" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTypeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票抬头" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTitle"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件人" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.consigneeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="手机号" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.phone"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件地址" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.collectAddress"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!--我的发票详情列表-->
              <el-table :data="taxsheet.taxsheetDetails" highlight-current-row border
                        max-height="500"
                        :summary-method="getSummaries"
                        show-summary v-loading="listLoading3" style="width: 100%;">
                <el-table-column type="index" label="序号" width="100">
                </el-table-column>
                <el-table-column prop="documentTypeName" label="单据类型">
                </el-table-column>
                <el-table-column prop="documentNumber" label="单据编号" width="200">
                </el-table-column>
                <el-table-column prop="documentAmount" label="单据金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.documentAmount != null">
                      {{Math.floor(scope.row.documentAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="currentInvoicedAmount" label="本次开票金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.currentInvoicedAmount != null">
                      {{Math.floor(scope.row.currentInvoicedAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="taxesAndFeesReceivable" label="本次应收税费(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.taxesAndFeesReceivable != null">
                      {{Math.floor(scope.row.taxesAndFeesReceivable * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
              </el-table>

            </div>
            <!--单位增值 税发票-->
            <div v-if="taxsheet.taxsheetType === 102013003">
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票类型" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTypeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票抬头" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTitle"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="纳税人识别号" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.taxpayersRegistrationNumber"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="开户银行名称" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.openingBank"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="开户银行账户" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.bankAccount"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="注册登记地址" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.registerLocalHost"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="公司电话" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.companyTelphone"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="12">
                  <el-form-item label="营业执照">
                    <el-upload
                      class="avatar-uploader"
                      action=""
                      :disabled="true"
                      :show-file-list="false">
                      <img width="75%" v-if="oldHeadUrl && invoiceManage.businessLicenseUrl"
                           :src="decodeURI(invoiceManage.httpHead+invoiceManage.businessLicenseUrl)"
                           class="avatar">
                      <img v-else-if="!oldHeadUrl && tempCurrentHeadUrl" :src="tempCurrentHeadUrl" class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="一般纳税人证明">
                    <el-upload
                      class="avatar-uploader"
                      action=""
                      :disabled="true"
                      :show-file-list="false">
                      <img width="75%" v-if="oldHeadUrl && invoiceManage.taxpayerProveUrl"
                           :src="decodeURI(invoiceManage.httpHead+invoiceManage.taxpayerProveUrl)"
                           class="avatar">
                      <img v-else-if="!oldHeadUrl && tempCurrentHeadUrl" :src="tempCurrentHeadUrl" class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件人" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.consigneeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="手机号" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.phone"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件地址" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.collectAddress"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!--我的发票详情列表-->
              <el-table :data="taxsheet.taxsheetDetails" highlight-current-row border
                        max-height="500"
                        :summary-method="getSummaries"
                        show-summary v-loading="listLoading3" style="width: 100%;">
                <el-table-column type="index" label="序号" width="100">
                </el-table-column>
                <el-table-column prop="documentTypeName" label="单据类型">
                </el-table-column>
                <el-table-column prop="documentNumber" label="单据编号" width="200">
                </el-table-column>
                <el-table-column prop="documentAmount" label="单据金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.documentAmount != null">
                      {{Math.floor(scope.row.documentAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="currentInvoicedAmount" label="本次开票金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.currentInvoicedAmount != null">
                      {{Math.floor(scope.row.currentInvoicedAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="taxesAndFeesReceivable" label="本次应收税费(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.taxesAndFeesReceivable != null">
                      {{Math.floor(scope.row.taxesAndFeesReceivable * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <!--企业增值税发票图片-->
            <div v-if="taxsheet.taxsheetType === 102013004">
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票类型" class="width70">
                    <el-input :readonly="true" v-model="taxsheet.taxsheetTypeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <img width="90%" v-bind:src="taxsheet.httpHead+taxsheet.enterpriseValueAddedTaxUrl">
                </el-col>
              </el-row>
              <!--我的发票详情列表-->
              <el-table :data="taxsheet.taxsheetDetails" highlight-current-row border
                        max-height="500"
                        :summary-method="getSummaries"
                        show-summary v-loading="listLoading3" style="width: 100%;">
                <el-table-column type="index" label="序号" width="100">
                </el-table-column>
                <el-table-column prop="documentTypeName" label="单据类型">
                </el-table-column>
                <el-table-column prop="documentNumber" label="单据编号" width="200">
                </el-table-column>
                <el-table-column prop="documentAmount" label="单据金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.documentAmount != null">
                      {{Math.floor(scope.row.documentAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="currentInvoicedAmount" label="本次开票金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.currentInvoicedAmount != null">
                      {{Math.floor(scope.row.currentInvoicedAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="taxesAndFeesReceivable" label="本次应收税费(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.taxesAndFeesReceivable != null">
                      {{Math.floor(scope.row.taxesAndFeesReceivable * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="发票号码" class="width70">
                  <el-input :disabled="true" v-model="taxsheet.taxsheetNo"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="开票日期" class="width70">
                  <el-input :disabled="true" v-model="taxsheet.billingDate"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="备注" class="width70">
                  <el-input type="textarea" :disabled="true" v-model="taxsheet.remark"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="上传图片">
                  <el-upload
                    action=""
                    :disabled="true"
                    class="avatar-uploader"
                    :show-file-list="false"
                  >
                    <img width="75%" v-if="oldHeadUrl && taxsheet.taxsheetPhotoUrl"
                         :src="decodeURI(taxsheet.httpHead+taxsheet.taxsheetPhotoUrl)"
                         class="avatar">
                    <img v-else-if="!oldHeadUrl && tempCurrentHeadUrl" :src="tempCurrentHeadUrl" class="avatar">
                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                  </el-upload>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-dialog>
      </el-tab-pane>
      <el-tab-pane label="已开票" name="openBilling">
        <!--工具条-->
        <search-bar more-display>
          <el-row>
            <el-col :span="8">
              <el-form-item label="客户名称">
                <el-input class="f-w70" v-model="realSearchCondition.LIKE_realName"
                          placeholder="请输入客户名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="发票类型">
                <el-select  v-model="realSearchCondition.EQ_taxsheetType"
                           placeholder="请选择">
                  <el-option
                    v-for="item in $store.getters.TAXSHEET_TYPE"
                    :key="item.dictVal"
                    :label="item.cnDictValname"
                    :value="item.dictVal">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="收件人">
                <el-input class="f-w70" v-model="realSearchCondition.LIKE_consigneeName"
                          placeholder="请输入收件人名称"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="支付状态">
                <el-select  v-model="realSearchCondition.EQ_taxationPayStatus"
                           placeholder="请选择">
                  <el-option
                    v-for="item in $store.getters.ORDER_PAY_STATUS"
                    :key="item.dictVal"
                    :label="item.cnDictValname"
                    :value="item.dictVal">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="申请开票时间">
                <el-date-picker
                  v-model="searchCreateDate"
                  type="daterange"
                  placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="发票抬头">
                <el-input class="f-w70" v-model="realSearchCondition.LIKE_taxsheetTitle"
                          placeholder="请输入发票抬头名称"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="发票号码">
                <el-input class="f-w70" v-model="realSearchCondition.LIKE_taxsheetNo"
                          placeholder="请输入发票号码"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </search-bar>
        <!-- 操作 -->
        <el-col :span="24" style="margin-bottom: 10px">
          <el-button type="primary" :disabled="this.sels.length===0">导出</el-button>
          <el-button type="primary" @click="searchReset" style="float: right">重置</el-button>
          <el-button type="primary" @click="OpenBillSearch" style="float: right">查询</el-button>
        </el-col>
        <!--列表-->
        <el-table :data="realOpenBillTableData" highlight-current-row border @sort-change="sortChange1" max-height="590"
                  @selection-change="selsChange1" v-loading="listLoading1" style="width: 100%;">
          <el-table-column type="selection" label="序号" width="100">
          </el-table-column>
          <el-table-column prop="realName" label="客户名称" width="150" >
          </el-table-column>
          <el-table-column prop="createDate" label="申请开票时间" width="180" >
          </el-table-column>
          <el-table-column prop="appTaxsheetAmount" label="开票金额(元)" width="140" >
            <template slot-scope="scope">
              <label v-if=" scope.row.appTaxsheetAmount != null">
                {{Math.floor(scope.row.appTaxsheetAmount * 100) / 100}}
              </label>
            </template>
          </el-table-column>
          <el-table-column prop="taxReceivable" label="应收税费(元)" width="140" >
            <template slot-scope="scope">
              <label v-if=" scope.row.taxReceivable != null">
                {{Math.floor(scope.row.taxReceivable * 100) / 100}}
              </label>
            </template>
          </el-table-column>
          <el-table-column prop="taxationPayStatusName" width="150" label="税费支付状态" >
          </el-table-column>
          <el-table-column prop="" label="发票信息">
            <template slot-scope="scope">
              <li style="list-style-type:none;" class="f-font-20 f-mb5">
                {{scope.row.taxsheetTypeName}}
              </li>
              <li style="list-style-type:none;" class="f-font-20 f-mb5">
                {{scope.row.taxsheetTitle}}
              </li>
            </template>
          </el-table-column>
          <el-table-column prop="" width="200" label="邮寄信息">
            <template slot-scope="scope">
              <li style="list-style-type:none;" class="f-font-20 f-mb5">
                {{scope.row.consigneeName}}   {{scope.row.phone}}
              </li>
              <li style="list-style-type:none;" class="f-font-20 f-mb5">
                {{scope.row.collectAddress}}
              </li>
            </template>
          </el-table-column>

          <el-table-column label="操作" width="180">
            <template slot-scope="scope">
              <el-button  type="primary" @click="getRealEditBYId(scope.$index, scope.row)">详情 </el-button>
            </template>
          </el-table-column>
        </el-table>
        <!--工具条-->
        <el-col :span="24" class="toolbar">
          <el-pagination
            :current-page="currentPage1"
            :page-size="pageSize1"
            @size-change="handleSizeChange1"
            @current-change="handleCurrentChange1"
            layout="total,sizes,prev, pager, next, jumper"
            :total="total1" style="float: right">
          </el-pagination>
        </el-col>
        <!----详情-->
        <el-dialog :title="openBillTitle"  :visible.sync="openBillVisible" :close-on-click-modal="false">
          <el-form :model="taxsheet" :rules="rules" label-width="110px" ref="taxsheet">
            <!--个人普通发票-->
            <div v-if="taxsheet.taxsheetType === 102013001">
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票类型" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTypeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票抬头" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTitle"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件人" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.consigneeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="手机号" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.phone"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件地址" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.collectAddress"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!--我的发票详情列表-->
              <el-table :data="taxsheet.taxsheetDetails" highlight-current-row border
                        max-height="500"
                        :summary-method="getSummaries"
                        show-summary v-loading="listLoading4" style="width: 100%;">
                <el-table-column type="index" label="序号" width="100">
                </el-table-column>
                <el-table-column prop="documentTypeName" label="单据类型">
                </el-table-column>
                <el-table-column prop="documentNumber" label="单据编号" width="200">
                </el-table-column>
                <el-table-column prop="documentAmount" label="单据金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.documentAmount != null">
                      {{Math.floor(scope.row.documentAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="currentInvoicedAmount" label="本次开票金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.currentInvoicedAmount != null">
                      {{Math.floor(scope.row.currentInvoicedAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="taxesAndFeesReceivable" label="本次应收税费(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.taxesAndFeesReceivable != null">
                      {{Math.floor(scope.row.taxesAndFeesReceivable * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>

              </el-table>

            </div>
            <!--单位普通发票-->
            <div v-if="taxsheet.taxsheetType === 102013002">
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票类型" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTypeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票抬头" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTitle"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件人" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.consigneeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="手机号" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.phone"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件地址" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.collectAddress"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!--我的发票详情列表-->
              <el-table :data="taxsheet.taxsheetDetails" highlight-current-row border
                        max-height="500"
                        :summary-method="getSummaries"
                        show-summary v-loading="listLoading4" style="width: 100%;">
                <el-table-column type="index" label="序1号" width="100">
                </el-table-column>
                <el-table-column prop="documentTypeName" label="单据类型">
                </el-table-column>
                <el-table-column prop="documentNumber" label="单据编号" width="200">
                </el-table-column>
                <el-table-column prop="documentAmount" label="单据金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.documentAmount != null">
                      {{Math.floor(scope.row.documentAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="currentInvoicedAmount" label="本次开票金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.currentInvoicedAmount != null">
                      {{Math.floor(scope.row.currentInvoicedAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="taxesAndFeesReceivable" label="本次应收税费(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.taxesAndFeesReceivable != null">
                      {{Math.floor(scope.row.taxesAndFeesReceivable * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <!--单位增值 税发票-->
            <div v-if="taxsheet.taxsheetType === 102013003">
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票类型" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTypeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票抬头" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.taxsheetTitle"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="纳税人识别号" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.taxpayersRegistrationNumber"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="开户银行名称" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.openingBank"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="开户银行账户" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.bankAccount"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="注册登记地址" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.registerLocalHost"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="公司电话" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.companyTelphone"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="12">
                  <el-form-item label="营业执照">
                    <el-upload
                      class="avatar-uploader"
                      action=""
                      :disabled="true"
                      :show-file-list="false"
                    >
                      <img width="75%" v-if="oldHeadUrl && invoiceManage.businessLicenseUrl"
                           :src="decodeURI(invoiceManage.httpHead+invoiceManage.businessLicenseUrl)"
                           class="avatar">
                      <img v-else-if="!oldHeadUrl && tempCurrentHeadUrl" :src="tempCurrentHeadUrl" class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="一般纳税人证明">
                    <el-upload
                      class="avatar-uploader"
                      action=""
                      :disabled="true"
                      :show-file-list="false"
                    >
                      <img width="75%" v-if="oldHeadUrl && invoiceManage.taxpayerProveUrl"
                           :src="decodeURI(invoiceManage.httpHead+invoiceManage.taxpayerProveUrl)"
                           class="avatar">
                      <img v-else-if="!oldHeadUrl && tempCurrentHeadUrl" :src="tempCurrentHeadUrl" class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件人" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.consigneeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="手机号" class="width70">
                    <el-input :disabled="true" v-model="taxsheet.phone"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="收件地址" class="width70">
                    <el-input :disabled="true" v-model="invoiceManage.collectAddress"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!--我的发票详情列表-->
              <el-table :data="taxsheet.taxsheetDetails" highlight-current-row border
                        max-height="500"
                        :summary-method="getSummaries"
                        show-summary v-loading="listLoading4" style="width: 100%;">
                <el-table-column type="index" label="序号" width="100">
                </el-table-column>
                <el-table-column prop="documentTypeName" label="单据类型">
                </el-table-column>
                <el-table-column prop="documentNumber" label="单据编号" width="200">
                </el-table-column>
                <el-table-column prop="documentAmount" label="单据金额(元)" width="160">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.documentAmount != null">
                      {{Math.floor(scope.row.documentAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="currentInvoicedAmount" label="本次开票金额(元)" width="160">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.currentInvoicedAmount != null">
                      {{Math.floor(scope.row.currentInvoicedAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="taxesAndFeesReceivable" label="本次应收税费(元)" width="160">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.taxesAndFeesReceivable != null">
                      {{Math.floor(scope.row.taxesAndFeesReceivable * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
              </el-table>
            </div>

            <!--企业增值税发票图片-->
            <div v-if="taxsheet.taxsheetType === 102013004">
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <el-form-item label="发票类型" class="width70">
                    <el-input :readonly="true" v-model="taxsheet.taxsheetTypeName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row class="f-mt10 f-mb10">
                <el-col :span="24">
                  <img width="90%" v-bind:src="taxsheet.httpHead+taxsheet.enterpriseValueAddedTaxUrl">
                </el-col>
              </el-row>
              <!--我的发票详情列表-->
              <el-table :data="taxsheet.taxsheetDetails" highlight-current-row border
                        max-height="500"
                        :summary-method="getSummaries"
                        show-summary v-loading="listLoading3" style="width: 100%;">
                <el-table-column type="index" label="序号" width="100">
                </el-table-column>
                <el-table-column prop="documentTypeName" label="单据类型">
                </el-table-column>
                <el-table-column prop="documentNumber" label="单据编号" width="200">
                </el-table-column>
                <el-table-column prop="documentAmount" label="单据金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.documentAmount != null">
                      {{Math.floor(scope.row.documentAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="currentInvoicedAmount" label="本次开票金额(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.currentInvoicedAmount != null">
                      {{Math.floor(scope.row.currentInvoicedAmount * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
                <el-table-column prop="taxesAndFeesReceivable" label="本次应收税费(元)" width="150">
                  <template slot-scope="scope">
                    <label v-if=" scope.row.taxesAndFeesReceivable != null">
                      {{Math.floor(scope.row.taxesAndFeesReceivable * 100) / 100}}
                    </label>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="发票号码" class="width70">
                  <el-input :readonly="true"  v-model="taxsheet.taxsheetNo"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="开票日期" class="width70">
                  <el-input :readonly="true"  v-model="taxsheet.billingDate"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="备注" class="width70">
                  <el-input type="textarea" :readonly="true"  v-model="taxsheet.remark"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row class="f-mt10 f-mb10">
              <el-col :span="24">
                <el-form-item label="确认开票上传的图片">
                  <img width="50%" v-bind:src="taxsheet.httpHead+taxsheet.taxsheetPhotoUrl">
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-dialog>
      </el-tab-pane>
    </el-tabs>
  </section>
</template>
<script>
import {
  searchNotOpenBilling
} from '../../api/clearing/TaxsheetManage.js';
import {
  saveTaxsheet,
  getTaxsheet
} from '../../api/meb-user/TaxSheet.js';
import {
  getInvoiceManage
} from '../../api/meb-user/TaxsheetTitle.js';
import {objToFilter, resetObjNull} from '../../lib/util';
export default {
  data () {
    return {
      oldHeadUrl: true,
      oldHeadUrl1: true,
      tempCurrentHeadUrl: '',
      tempCurrentHeadUrl1: '',
      openBillAll: 'notOpenBilling',
      notSearchCreateDate: [],
      searchCreateDate: [],
      notSearchCondition: {
        EQ_taxsheetType: null,
        LIKE_consigneeName: '',
        EQ_taxationPayStatus: '',
        GT_createDate: null,
        LIKE_taxsheetTitle: null,
        LT_createDate: null
      },
      realSearchCondition: {
        LIKE_realName: null,
        EQ_taxsheetType: null,
        LIKE_consigneeName: '',
        EQ_taxationPayStatus: '',
        GT_createDate: null,
        LIKE_taxsheetTitle: null,
        LIKE_taxsheetNo: null,
        LT_createDate: null
      },
      dialogTitle: '新增',
      notOpenBillTitle: '详情',
      openBillTitle: '详情',
      affirmOpenBillTitle: '确认开票',
      condition: {
        name: '',
        number: ''
      },
      sels: [],
      tableData: [],
      total: 0,
      currentPage: 1,
      pageSize: 10,
      sortProp: null,
      sortOrder: 'ascending',
      sels1: [],
      realOpenBillTableData: [],
      total1: 0,
      currentPage1: 1,
      pageSize1: 10,
      sortProp1: null,
      sortOrder1: 'ascending',
      listLoading: false,
      listLoading1: false,
      listLoading2: false,
      listLoading3: false,
      listLoading4: false,
      notOpenBillVisible: false,
      openBillVisible: false,
      affirmOpenBillVisible: false,
      submitLoading: false,
      submitLoading1: false,
      // 发票抬头表单数据
      invoiceManage: {
        'id': null,
        'httpHead': null,
        'realName': null,
        'myAddress': [],
        'taxsheetType': null,
        'taxsheetTitle': null,
        'consigneeId': null,
        'consigneeName': null,
        'isActiveBilling': null,
        'phone': null,
        'telphone': null,
        'provinceId': null,
        'province': null,
        'city': null,
        'cityId': null,
        'county': null,
        'countyId': null,
        'street': null,
        'isDefault': null,
        'taxpayersRegistrationNumber': null,
        'openingBank': null,
        'bankAccount': null,
        'registerLocalHost': null,
        'companyTelphone': null,
        'businessLicenseUrl': null,
        'taxpayerProveUrl': null
      },
      // 表单数据
      taxsheet: {
        'id': null,
        'userId': null,
        'taxsheetPhotoUrl': null,
        'remark': null,
        'taxsheetNo': null,
        'billingStatusName': null,
        'taxsheetNumber': null,
        'taxsheetTypeName': null,
        'myAddress': [],
        delIds: [],
        'billingDate': null,
        'appTaxsheetAmount': null,
        'taxsheetType': null,
        'taxsheetTitle': null,
        'taxsheetTitleId': null,
        'taxsheetTitleIds': '',
        'consigneeId': null,
        'consigneeName': null,
        'phone': null,
        'telphone': null,
        'provinceId': null,
        'cityId': null,
        'countyId': null,
        'street': null,
        'collectAddress': null,
        'isDefault': null,
        'isActiveBilling': null,
        'taxpayersRegistrationNumber': null,
        'openingBank': null,
        'bankAccount': null,
        'registerLocalHost': null,
        'companyTelphone': null,
        'businessLicenseUrl': null,
        'taxpayerProveUrl': null,
        'billingStatus': null,
        'taxsheetDetails': {
          'id': null,
          'documentType': null,
          'invoicePeriodStart': null,
          'invoicePeriodEnd': null,
          'documentNumber': null,
          'documentAmount': null,
          'taxMayBeInvoiced': null,
          'invoicedAmount': null,
          'currentInvoicedAmount': null,
          'taxesAndFeesReceivable': null,
          'taxsheet': null
        }
      },
      // 验证规则
      rules: {
        billingDate: [
          {type: 'date', required: true, message: '请选择开票时间', trigger: 'blur'}
        ],
        taxsheetNo: [
          {required: true, message: '请输入请输入发票号码', trigger: 'blur'},
          {min: 8, max: 20, message: '长度在8到 60 个字符', trigger: 'blur'}
        ]
      }
    };
  },
  watch: {
    notSearchCreateDate (val) {
      this.notSearchCondition.GT_createDate = val[0] == null ? null : val[0].Format('yyyy-MM-dd') + ' 00:00:00';
      this.notSearchCondition.LT_createDate = val[1] == null ? null : val[1].Format('yyyy-MM-dd') + ' 23:59:59';
    },
    searchCreateDate (val) {
      this.realSearchCondition.GT_createDate = val[0] == null ? null : val[0].Format('yyyy-MM-dd') + ' 00:00:00';
      this.realSearchCondition.LT_createDate = val[1] == null ? null : val[1].Format('yyyy-MM-dd') + ' 23:59:59';
    }
  },
  methods: {
    // 表格合计
    getSummaries (param) {
      const {columns, data} = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计:';
          return;
        }
        if (index === 1) {
          sums[index] = '';
          return;
        }
        if (index === 2) {
          sums[index] = '';
          return;
        }
        const values = data.map(item => Number(item[column.property]));
        if (!values.every(value => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return Math.floor((prev + curr) * 100) / 100;
            } else {
              return prev;
            }
          }, 0);
          sums[index] += ' 元';
        } else {
          sums[index] = 'N/A';
        }
      });

      return sums;
    },
    // 图片上传限制
    beforeAvatarUpload (file) {
      let isJPG = false;
      if (file.type) {
        const fileTypes = 'image/jpeg;image/png;image/bmp;image/tiff;image/wmf';
        isJPG = fileTypes.indexOf(file.type) !== -1;
      }
      const isLt2M = file.size / 1024 / 1024 < 2;

      if (!isJPG) {
        this.$message.error('上传头像图片只能是 JPG/PNG/BMP/TIFF/WMF 格式!');
      }
      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!');
      }
      return isJPG && isLt2M;
    },
    handleAvatarError () {
      this.$message.error('上传图片失败!');
    },
    handleRemove (file, fileList) {
      console.log(file, fileList);
    },
    // 图片地址赋值
    handlePreview (res, file) {
      this.oldHeadUrl = false;
      this.taxsheet.taxsheetPhotoUrl = file.response.obj;
      this.tempCurrentHeadUrl = URL.createObjectURL(file.raw);// 临时
    },
    // 切换标签时的方法
    selectOpenBill () {
      this.getTableData();
      this.getRealTableData();
    },
    /**
       * 未开票-搜索栏重置
       */
    notSearchReset () {
      this.notSearchCreateDate = [];
      resetObjNull(this.notSearchCondition);
    },
    // 已开票--搜索栏重置
    searchReset () {
      this.searchCreateDate = [];
      resetObjNull(this.realSearchCondition);
    },
    loadingLists (filter) {
      this.listLoading = true;
      searchNotOpenBilling({
        filters: filter + ';EQ_billingStatus=102014002',
        size: this.pageSize,
        page: this.currentPage,
        sorts: (this.sortProp === null ? '' : (this.sortOrder === 'ascending' ? '-' : '+') + this.sortProp)
      }).then(res => {
        if (res.data.successFlg) {
          this.tableData = res.data.detailModelList;
          this.currentPage = res.data.currPage;
          this.total = res.data.totalCount;
          this.pageSize = res.data.pageSize;
          this.listLoading = false;
        }
      });
    },
    loadingLists1 (filter) {
      this.listLoading1 = true;
      searchNotOpenBilling({
        filters: filter + ';EQ_billingStatus=102014003',
        size: this.pageSize1,
        page: this.currentPage1,
        sorts: (this.sortProp1 === null ? '' : (this.sortOrder1 === 'ascending' ? '-' : '+') + this.sortProp1)
      }).then(res => {
        if (res.data.successFlg) {
          this.realOpenBillTableData = res.data.detailModelList;
          this.currentPage1 = res.data.currPage;
          this.total1 = res.data.totalCount;
          this.pageSize1 = res.data.pageSize;
          this.listLoading1 = false;
        }
      });
    },
    //      // 未开票 搜索栏搜索
    notOpenBillSearch () {
      this.loadingLists(objToFilter(this.notSearchCondition));
    },
    //      // 已开票 搜索栏搜索
    OpenBillSearch () {
      this.loadingLists1(objToFilter(this.realSearchCondition));
    },
    // 打开未开票详情界面
    getEditBYId (index, row) {
      this.oldHeadUrl = false;
      this.oldHeadUrl1 = false;
      this.tempCurrentHeadUrl = '';
      this.tempCurrentHeadUrl1 = '';
      this.resetForm();
      this.resetForm1();
      if (row.taxsheetType === 102013003) {
        getInvoiceManage(row.taxsheetTitleId).then((res) => {
          if (res.data.successFlg) {
            this.oldHeadUrl = true;
            this.invoiceManage = res.data.obj;
          }
        });
      }
      getTaxsheet(row.id).then((res) => {
        if (res.data.successFlg) {
          this.oldHeadUrl1 = true;
          this.taxsheet = res.data.obj;
        }
      });
      this.notOpenBillTitle = '发票详情';
      this.notOpenBillVisible = true;
    },
    // 打开已开票详情界面
    getRealEditBYId (index, row) {
      this.oldHeadUrl = false;
      this.oldHeadUrl1 = false;
      this.tempCurrentHeadUrl = '';
      this.tempCurrentHeadUrl1 = '';
      this.resetForm();
      this.resetForm1();
      if (row.taxsheetType === 102013003) {
        getInvoiceManage(row.taxsheetTitleId).then((res) => {
          if (res.data.successFlg) {
            this.oldHeadUrl = true;
            this.invoiceManage = res.data.obj;
          }
        });
      }
      getTaxsheet(row.id).then((res) => {
        if (res.data.successFlg) {
          this.oldHeadUrl1 = true;
          this.taxsheet = res.data.obj;
        }
      });
      this.openBillTitle = '发票详情';
      this.openBillVisible = true;
    },
    // 确认开票窗体
    affirmOpenBill (index, row) {
      this.affirmOpenBillTitle = '新增';
      this.oldHeadUrl = false;
      this.tempCurrentHeadUrl = '';
      this.resetForm();
      this.taxsheet = Object.assign({}, row);
      this.affirmOpenBillVisible = true;
    },
    // 重置表单
    resetForm () {
      if (this.$refs.taxsheet) {
        this.$refs.taxsheet.resetFields();
      }
      // 当先点击修改，再点击新增，会出现值没有清空,修复处理
      for (let p in this.taxsheet) {
        if (this.taxsheet[p] instanceof Array) {
          this.taxsheet[p] = [];
        } else {
          this.taxsheet[p] = null;
        }
      }
    },

    // 重置表单
    resetForm1 () {
      if (this.$refs.invoiceManage) {
        this.$refs.invoiceManage.resetFields();
      }
      // 当先点击修改，再点击新增，会出现值没有清空,修复处理
      for (let p in this.invoiceManage) {
        if (this.invoiceManage[p] instanceof Array) {
          this.invoiceManage[p] = [];
        } else {
          this.invoiceManage[p] = null;
        }
      }
    },
    // 多选操作
    selsChange1 (sels) {
      this.sels1 = sels;
    },
    // 排序操作
    sortChange1 (o) {
      this.sortProp1 = o.prop;
      this.sortOrder1 = o.order;
      this.OpenBillSearch();
    },
    // 每页几条操作
    handleSizeChange1 (val) {
      this.pageSize1 = val;
      this.OpenBillSearch();
    },
    // 第几页操作
    handleCurrentChange1 (val) {
      this.currentPage1 = val;
      this.OpenBillSearch();
    },

    // 多选操作
    selsChange (sels) {
      this.sels = sels;
    },
    // 排序操作
    sortChange (o) {
      this.sortProp = o.prop;
      this.sortOrder = o.order;
      this.notOpenBillSearch();
    },
    // 每页几条操作
    handleSizeChange (val) {
      this.pageSize = val;
      this.notOpenBillSearch();
    },
    // 第几页操作
    handleCurrentChange (val) {
      this.currentPage = val;
      this.notOpenBillSearch();
    },
    // 确认开票数据提交
    saveOpenBillDetail () {
      // 表单验证
      this.$refs['taxsheet'].validate((valid) => {
        if (valid) {
          this.submitLoading1 = true;
          saveTaxsheet(this.taxsheet).then((res) => {
            this.submitLoading1 = false;
            if (res.data.successFlg === true) {
              this.affirmOpenBillVisible = false;
              this.getTableData();
              this.getRealTableData();
              this.$message.success('保存/修改成功！');
            } else {
              this.$message.error(res.data.errorMsg);
            }
          }).catch(function (error) {
            console.log(error);
          });
        } else {
          return false;
        }
      });
    },

    // 获取未开票数据
    getTableData () {
      this.listLoading = true;
      searchNotOpenBilling({
        filters: 'EQ_billingStatus=102014002',
        sorts: '',
        page: this.currentPage,
        size: this.pageSize
      }).then((res) => {
        if (res.data.successFlg === true) {
          this.tableData = res.data.detailModelList;
          this.currentPage = res.data.currPage;
          this.total = res.data.totalCount;
          this.pageSize = res.data.pageSize;
          this.listLoading = false;
        } else {
          this.$message.error(res.data.errorMsg);
        }
      });
    },
    // 获取已开票数据
    getRealTableData () {
      this.listLoading = true;
      searchNotOpenBilling({
        filters: 'EQ_billingStatus=102014003',
        sorts: '',
        page: this.currentPage1,
        size: this.pageSize1
      }).then((res) => {
        if (res.data.successFlg === true) {
          this.realOpenBillTableData = res.data.detailModelList;
          this.currentPage1 = res.data.currPage;
          this.total1 = res.data.totalCount;
          this.pageSize1 = res.data.pageSize;
          this.listLoading1 = false;
        } else {
          this.$message.error(res.data.errorMsg);
        }
      });
    }
  },

  // 初始化数据
  mounted () {
    this.getTableData();
    this.getRealTableData();
    this.$store.commit('initDict');
  }
};
</script>
<style lang="less"></style>
